package com.pachong.android.framework;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.pachong.android.baseuicomponent.activity.BaseActivity;
import com.pachong.android.frameworkbase.customviews.iconcontent.IconTextArrowButton;
import com.pachong.android.frameworkbase.utils.AppUtil;

/**
 * Http demo 索引界面
 *
 * @Author: Administrator
 * @E-mail: pengveivei@sina.cn
 * @CreateDate: 2017/1/3
 * @Version: 1.0.0
 */
public class SecretCodeActivity extends BaseActivity {

    IconTextArrowButton btnAppName;
    IconTextArrowButton btnVertionName;
    IconTextArrowButton btnVertionCode;
    IconTextArrowButton btnBuildType;
    IconTextArrowButton btnBuildDate;
    IconTextArrowButton btnBuildHost;
    IconTextArrowButton btnBuildRevision;

    public static void start(Context context) {
        Intent starter = new Intent(context, SecretCodeActivity.class);
//        starter.putExtra("type", type);
        context.startActivity(starter);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        updateViews();

    }

    private void updateViews() {
        btnAppName.setSubText(AppUtil.getApplicationName(this));
        btnVertionName.setSubText(AppUtil.getVersionName(this));
        btnVertionCode.setSubText(""+AppUtil.getVersionCode(this));
        btnBuildDate.setSubText(getString(R.string.app_build_time));
        btnBuildHost.setSubText(getString(R.string.app_build_host));
        btnBuildRevision.setSubText(getString(R.string.app_build_revision));
        if (TextUtils.isEmpty(mBuildType)) {
            mBuildType = "没有配置build type";
        }
        btnBuildType.setSubText(mBuildType);

    }


    @Override
    public View createDataView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View view = layoutInflater.inflate(R.layout.activity_secret_code, viewGroup, false);
        btnAppName = (IconTextArrowButton) view.findViewById(R.id.btnAppName);
        btnVertionName = (IconTextArrowButton) view.findViewById(R.id.btnVertionName);
        btnVertionCode = (IconTextArrowButton) view.findViewById(R.id.btnVertionCode);
        btnBuildType = (IconTextArrowButton) view.findViewById(R.id.btnBuildType);
        btnBuildDate = (IconTextArrowButton) view.findViewById(R.id.btnBuildDate);
        btnBuildHost = (IconTextArrowButton) view.findViewById(R.id.btnBuildHost);
        btnBuildRevision = (IconTextArrowButton) view.findViewById(R.id.btnBuildRevision);
        return view;
    }

    private static String mBuildType;
    public static void setBuildType(String buildType) {
        mBuildType = buildType;
    }

}